<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <link rel="shortcut icon" href="../static/favicon.ico"/>
    <link rel="bookmark" href="/favicon.ico"/>
    <link rel="stylesheet" type="text/css" href="../static/css/base.css">
    <link rel="stylesheet" type="text/css" href="../static/css/index.css">
</head>

<body>
    <header>
        <div class="container clearfix" id="top">
            <a href="/index"><img class="logo" src="../static/img/logo.png"></a>
            <a class="topbar-item active" href="/index">首页</a>
            <a class="topbar-item " href="/category">小吃分类</a>
            <span th:if="${session.user} != null">
            <a class="topbar-item" href="/my" th:if="${session.user.username!='admin'}">个人中心</a>
            <a class="topbar-item" href="/admin" th:if="${session.user.username=='admin'}">个人中心</a>
            </span>
            <nav th:if="${session.user} == null">
                <a href="/register">注册</a>
                <span>|</span>
                <a href="/login">登录</a>
            </nav>
            <nav th:if="${session.user} != null">
                您好！<span th:text="${session.user.getUsername()}"></span>，<a href="/loginOut">退出</a>
            </nav>
        </div>
    </header>
    <a id="toTop"  title="回到顶部"><img src="../static/img/scroll_top1.png"></a>
    <div id="banner">
        <ul>
            <li th:each="banner:${banners}" th:class="${bannerStat.index==0}? 'on':''"></li>
        </ul>
        <div id="banner_list"> 
            <a th:each="banner:${banners}" ><img th:src="${banner.url}" /></a>
        </div>
    </div>
    <div class="content-container">
        <div class="no-recom-container">
            <div class="floor-content-start">
                <div class="floor-content">
                    <div class="floor-header">
                        <h3>最新美食</h3>
                        <ul class="reco-words">
                            <li><a class="no-right-border no-right-padding" target="_blank" href="/category">>>更多</a></li>
                        </ul>
                    </div>
                    <ul class="itemlist eight-row-height">
                        <li class="j-card" th:each="delicious:${deliciouses}">
                            <a th:href="'/detail?foodId='+${delicious.getId()}">
                            <div class="imgbox">
                                <div class="borderbox">
                                    <img th:src="${delicious.getFoodImg()}" />
                                </div>
                            </div>
                            </a>
                            <div class="contentbox">
                                <a th:href="'/detail?foodId='+${delicious.getId()}" target="_blank">
                                <div class="header">
                                    <h4 class="title" th:title="${delicious.getName()}" th:text="${delicious.getName()}"></h4>
                                </div>
                                </a>
                                <div class="footer">
                                    <div class="rank clearfix">
                                        <span class="star-ranking fl">
                                                <span class="star-score star" th:attr="data-score=${delicious.getScore()}" ></span>
                                        </span>
                                        <span class="score-num fl" th:if="${delicious.getScore() eq '0'}" th:text="暂无评分"></span>
                                        <span class="score-num fl" th:if="${delicious.getScore() ne '0'}" th:text="${delicious.getScore()}+'分'"></span>
                                        <span class="coment-count" th:text="${delicious.getCommentCount()}+'点评'"></span>
                                    </div>

                                    <div class="bottom-border"></div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="floor-content">
                    <div class="floor-header">
                        <h3>甄选推荐</h3>
                        <ul class="reco-words">
                            <li><a class="no-right-border no-right-padding" target="_blank" href="/category">>>更多</a></li>
                        </ul>
                    </div>
                    <ul class="itemlist eight-row-height">
                        <li class="j-card" th:each="recommend:${recommends}">
                                <a th:href="'/detail?foodId='+${recommend.getId()}">
                                    <div class="imgbox">
                                        <div class="borderbox">
                                            <img th:src="${recommend.getFoodImg()}" />
                                        </div>
                                    </div>
                                </a>
                            <div class="contentbox">
                                    <a th:href="'/detail?foodId='+${recommend.getId()}">
                                        <div class="header">
                                            <h4 class="title" th:title="${recommend.getName()}" th:text="${recommend.getName()}"></h4>
                                        </div>
                                    </a>
                                <div class="footer">
                                    <div class="rank clearfix">
                                        <span class="star-ranking fl">
                                                <span class="star-score star" th:attr="data-score=${recommend.getScore()}" ></span>
                                        </span>
                                        <span class="score-num fl" th:if="${recommend.getScore() eq '0'}" th:text="暂无评分"></span>
                                        <span class="score-num fl" th:if="${recommend.getScore() ne '0'}" th:text="${recommend.getScore()}+'分'"></span>
                                        <span class="coment-count" th:text="${recommend.getCommentCount()}+'点评'"></span>
                                    </div>

                                    <div class="bottom-border"></div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="../static/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="../static/js/base.js"></script>
    <script>
        $(function () {
            sessionStorage.setItem("tabLiNum",0);
            $(".star").width(function () {
                return $(this).attr("data-score")/5*72;
            })
        })

    </script>
</body>

</html>